package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

class zauk {
   int a = -1;
   String b = null;
   zaul c;
   byte d;
   zqr[] e;
   String[][] f;
   int[][] g;
   boolean h;
   int i;
   int j;
   int k;
   int l;
   int m;
   zaun n;
   int o;
   ArrayList p;
   ArrayList q;
   int r = -1;
   DateTime s;
   Worksheet t;
   int u;
   zaur v;
   String w = "Aspose";
   String x = "3";
   int y = 2730;
   ArrayList z = null;
   zauj A;
   int B = -1;
   HashMap C;
   String D;
   zqc E;
   String F;
   ArrayList G;
   boolean H = false;
   String I;
   byte[] J;
   byte[] K;
   zbqs L;

   zauk(zaul var1, byte var2, String[] var3, PivotPageFields var4, boolean var5, int var6, Worksheet var7) {
      this.c = var1;
      this.d = var2;
      this.e = new zqr[var3.length];
      this.l = 37;
      this.o = 0;
      this.r = var6;
      this.s = new DateTime();
      this.t = var7;
      this.h = var5;
      switch(this.d) {
      case 1:
         this.d(var3[0]);
         break;
      case 4:
         if (!var5) {
            this.a(var4);
         }

         this.a(var3);
         break;
      default:
         throw new IllegalArgumentException("Unsupported PivotTable source type.");
      }

      this.A = new zauj();
      this.A.a(this);
   }

   zauk(zaul var1, int var2, Worksheet var3) {
      this.c = var1;
      this.r = var2;
      this.t = var3;
      this.s = new DateTime();
      this.A = new zauj();
      this.A.a(this);
   }

   zauk(zaul var1) {
      this.c = var1;
      this.s = new DateTime();
      this.A = new zauj();
   }

   void a(zauk var1) throws Exception {
      int var2;
      if (var1.z != null) {
         this.z = new ArrayList();

         for(var2 = 0; var2 < var1.z.size(); ++var2) {
            com.aspose.cells.b.a.a.ze.a(this.z, var1.z.get(var2));
         }

         if (this.c.b.f() == null) {
            this.c.b.a(new zvh(WorksheetCollection.h));
         }

         zane var5 = this.c.b.f().a().b("_SX_DB_CUR");
         if (var5 == null) {
            var5 = new zane(new com.aspose.cells.b.a.zh("00000000-0000-0000-0000-000000000000"));
            this.c.b.f().a().a("_SX_DB_CUR", var5);
         }

         String var3 = com.aspose.cells.a.c.zp.d(this.r);
         com.aspose.cells.b.a.d.zh var4 = var1.c.b.f().a().b("_SX_DB_CUR").a(com.aspose.cells.a.c.zp.d(var1.r));
         if (var4 != null) {
            var5.a(var3, var4);
         }

      } else {
         this.d = var1.d;
         if (var1.e != null) {
            this.e = new zqr[var1.e.length];
         }

         this.l = var1.l;
         this.o = 0;
         this.s = var1.s;
         this.h = var1.h;
         if (var1.E != null) {
            if (this.c.b.n().b == null) {
               this.c.b.n().b = new zps(this.c.b.n());
               this.c.b.n().b.b = new zpn();
            }

            this.c.b.n().b.b.a = var1.c.b.n().b.b.a;
            this.c.b.n().b.b.b = var1.c.b.n().b.b.b;
            this.r = var1.r;
            this.E = new zqc(this);
            this.E.a(var1.E);
         } else {
            switch(this.d) {
            case 1:
               if (var1.e != null) {
                  for(var2 = 0; var2 < var1.e.length; ++var2) {
                     this.c(var1.e[var2].a());
                  }
               }
               break;
            case 4:
               this.f = var1.f;
               this.g = var1.g;
               this.h = var1.h;
               this.a(var1.g());
               break;
            default:
               throw new IllegalArgumentException("Unsupported PivotTable source type.");
            }

            this.p = new ArrayList(var1.p.size());

            for(var2 = 0; var2 < var1.p.size(); ++var2) {
               com.aspose.cells.b.a.a.ze.a(this.p, var1.p.get(var2));
            }

            this.n = new zaun(this);
            this.n = var1.n;
         }
      }
   }

   int a(String var1) {
      ArrayList var2 = this.p;
      String var3 = var1.toUpperCase();
      if (var3 != null && var3.charAt(0) == '\'') {
         var3 = var3.substring(1, 1 + (var3.length() - 2));
      }

      this.L = (zbqs)this.p.get(this.p.size() - 1);
      ArrayList var4 = this.L.f;
      int var5 = -1;

      int var6;
      for(var6 = 0; var6 < var4.size(); ++var6) {
         zbrf var7 = (zbrf)var4.get(var6);
         if (((zbqs)var2.get(var7.b & '\uffff')).a.toUpperCase().equals(var3)) {
            var5 = var6;
            break;
         }
      }

      if (var5 == -1) {
         for(var6 = 0; var6 < var2.size(); ++var6) {
            if (((zbqs)var2.get(var6)).a.toUpperCase().equals(var3)) {
               var5 = var4.size();
               com.aspose.cells.b.a.a.ze.a(var4, (Object)(new zbrf(var6)));
               break;
            }
         }
      }

      return var5;
   }

   void a(String var1, String var2) {
      for(int var3 = 0; var3 < this.p.size(); ++var3) {
         zbqs var4 = (zbqs)this.p.get(var3);
         if (var4.a != null && com.aspose.cells.b.a.zv.b(var4.a, var1)) {
            throw new CellsException(10, "Invalid calculated field name,it could not be same as the previous field name.");
         }
      }

      zbqs var10 = new zbqs(this, var1, var2);
      com.aspose.cells.b.a.a.ze.a(this.p, (Object)var10);
      ++this.j;
      WorksheetCollection var11 = this.c.b;
      var11.a((Object)this);
      var10.e = var11.x().a(-1, var2, 0, 0, 0, 64, false, false, false);
      var11.a((Object)null);
      Iterator var5 = this.c.b.iterator();

      while(true) {
         Worksheet var6;
         do {
            do {
               if (!var5.hasNext()) {
                  return;
               }

               var6 = (Worksheet)var5.next();
            } while(var6.b == null);
         } while(var6.b.getCount() == 0);

         for(int var7 = 0; var7 < var6.b.getCount(); ++var7) {
            if (var6.b.get(var7).d == this) {
               var6.b.get(var7).getBaseFields().a(var10);

               for(int var8 = 0; var8 < this.p.size(); ++var8) {
                  zbqs var9 = (zbqs)this.p.get(var8);
                  if (var9.m() && var9 != var10 && var6.b.get(var7).getBaseFields().a(var9.a) == null) {
                     var6.b.get(var7).getBaseFields().a(var9);
                  }
               }
            }
         }
      }
   }

   int a() {
      return this.u;
   }

   void a(int var1) {
      this.u = var1;
   }

   void b(int var1) {
      zbqs var2 = (zbqs)this.p.get(var1);

      for(int var3 = 0; var3 < var2.c.size(); ++var3) {
         zbmb var4 = (zbmb)var2.c.get(var3);
         if (var4.a instanceof Double) {
            var2.d(true);
         } else if (var4.a instanceof Integer) {
            var2.c(true);
         } else if (var4.a instanceof String) {
            var2.e(true);
         } else if (var4.a == null) {
            var2.j(true);
         }
      }

   }

   zqr b(String var1) {
      zqr var2 = new zqr(this, this.t, var1);
      Object[] var3 = a(this.c.b, var1, this.t);
      Object var4 = var3[0];
      Worksheet var5 = (Worksheet)var3[1];
      if (var5 == null && this.t != null) {
         var5 = this.t;
      }

      if (var4 instanceof Name) {
         var2.b = ((Name)var4).s();
         if (var2.b == null) {
            throw new IllegalArgumentException("Invalid pivot table data source");
         }

         var5 = var2.b.getWorksheet();
         var2.b.a(((Name)var4).i());
      } else if (var4 instanceof ListObject) {
         ListObject var6 = (ListObject)var4;
         CellArea var7 = new CellArea();
         if (var3.length > 2) {
            var7.StartRow = var6.getStartRow();
            if (var6.j()) {
               var7.EndRow = var6.getEndRow() - var6.A();
            } else {
               var7.EndRow = var6.getEndRow();
            }

            var7.StartColumn = (Integer)var3[2];
            var7.EndColumn = (Integer)var3[3];
         } else {
            var7.StartRow = var6.getStartRow();
            if (var6.j()) {
               var7.EndRow = var6.getEndRow() - var6.A();
            } else {
               var7.EndRow = var6.getEndRow();
            }

            var7.StartColumn = var6.getStartColumn();
            var7.EndColumn = var6.getEndColumn();
         }

         var2.b = var5.getCells().createRange(var7.StartRow, var7.StartColumn, var7.EndRow - var7.StartRow + 1, var7.EndColumn - var7.StartColumn + 1);
         if (var2.b == null) {
            throw new IllegalArgumentException("Invalid table data source");
         }

         var5 = var2.b.getWorksheet();
         if (var3.length <= 2) {
            var2.b.a(((ListObject)var4).f());
         } else {
            var2.b.a(var1);
         }
      } else {
         if (var5 == null) {
            throw new IllegalArgumentException("Invalid pivot table data source");
         }

         CellArea var8 = (CellArea)var4;
         var2.b = var5.getCells().createRange(var8.StartRow, var8.StartColumn, var8.EndRow - var8.StartRow + 1, var8.EndColumn - var8.StartColumn + 1);
      }

      var2.a = var5;
      return var2;
   }

   void a(int var1, int var2, Worksheet var3) {
      if (this.e != null) {
         for(int var4 = 0; var4 < this.e.length; ++var4) {
            zqr var5 = this.e[var4];
            Range var6 = var5.b;
            CellArea var7 = var6.a();

            for(int var8 = 0; var8 < var3.c().getNames().getCount(); ++var8) {
               Name var9 = var3.c().getNames().get(var8);
               if (com.aspose.cells.b.a.zv.b(var6.getName(), var9.getText())) {
                  var5.b = var9.s();
                  return;
               }
            }

            if (var3 == var5.a && var1 == var7.EndRow) {
               String var10 = var5.b.getName();
               var5.b = new Range(var7.StartRow, var7.StartColumn, var7.EndRow + var2 - var7.StartRow + 1, var7.EndColumn - var7.StartColumn + 1, var3.getCells());
               var5.b.a(var10);
            }
         }
      }

   }

   void b(int var1, int var2, Worksheet var3) {
      if (this.e != null) {
         for(int var4 = 0; var4 < this.e.length; ++var4) {
            zqr var5 = this.e[var4];
            Range var6 = var5.b;
            if (var6 == null) {
               return;
            }

            CellArea var7 = var6.a();
            if (var3.getListObjects() != null && var3.getListObjects().getCount() > 0) {
               return;
            }

            for(int var8 = 0; var8 < var3.c().getNames().getCount(); ++var8) {
               Name var9 = var3.c().getNames().get(var8);
               if (com.aspose.cells.b.a.zv.b(var6.getName(), var9.getText())) {
                  var5.b = var9.s();
                  return;
               }
            }

            if (var3 == var5.a) {
               boolean var11 = false;
               boolean[] var12 = new boolean[]{var11};
               CellArea var10 = zayd.a(var7, var1, var2, var12);
               var11 = var12[0];
               var5.b = new Range(var10.StartRow, var10.StartColumn, var10.EndRow - var10.StartRow + 1, var10.EndColumn - var10.StartColumn + 1, var3.getCells());
            }
         }
      }

   }

   String c(int var1) {
      if (this.L == null) {
         return "";
      } else {
         ArrayList var2 = this.L.f;
         zbrf var3 = (zbrf)var2.get(var1);
         zbqs var4 = (zbqs)this.p.get(var3.b & '\uffff');
         String var5 = var4.a;
         String var6 = "";
         if (var5 == null) {
            var6 = "(Blank)";
         } else {
            var6 = var5;
         }

         if (zyn.c(var6)) {
            var6 = '\'' + var6 + '\'';
         }

         return var6;
      }
   }

   void a(StringBuilder var1, int var2) {
      if (this.L != null) {
         ArrayList var3 = this.L.f;
         zbrf var4 = (zbrf)var3.get(var2);
         zbqs var5 = (zbqs)this.p.get(var4.b & '\uffff');
         String var6 = var5.a;
         String var7 = "";
         if (var6 == null) {
            var7 = "(Blank)";
         } else {
            var7 = var6;
         }

         if (zaan.b(var7)) {
            var1.append('\'');
            var1.append(var7);
            var1.append('\'');
         } else {
            var1.append(var7);
         }

      }
   }

   void a(ArrayList var1) {
      for(int var2 = 0; var2 < this.p.size(); ++var2) {
         zbqs var3 = (zbqs)this.p.get(var2);
         if (var3.d != null || var3.m() || var3.c != null && var3.c.size() == 0 && var3.j != null) {
            com.aspose.cells.b.a.a.ze.a(var1, (Object)var3);
         }
      }

   }

   ArrayList a(zbqs var1) {
      ArrayList var2 = new ArrayList();
      if (var1.c != null) {
         for(int var3 = 0; var3 < var1.c.size(); ++var3) {
            zbmb var4 = (zbmb)var1.c.get(var3);
            if (var4 != null && var4.b) {
               com.aspose.cells.b.a.a.ze.a(var2, (Object)var4);
            }
         }
      }

      return var2;
   }

   void c(String var1) {
      zqr var2 = this.b(var1);
      this.e[0] = var2;
      ArrayList var3 = new ArrayList();
      if (this.p != null) {
         this.a(var3);
      }

      Range var4 = var2.b;
      Cells var5 = var2.a.getCells();
      int var6 = var4.getFirstRow();
      int var7 = var4.getFirstColumn();
      this.j = var4.getColumnCount() + var3.size();
      this.i = var4.getColumnCount();
      this.k = var4.getRowCount() - 1;
      this.q = this.p;
      this.p = new ArrayList(this.i);
   }

   void d(String var1) {
      zqr var2 = this.b(var1);
      ArrayList var3 = new ArrayList();
      if (this.p != null) {
         this.a(var3);
      }

      Range var4 = var2.b;
      Cells var5 = var2.a.getCells();
      if (this.e[0] != null && this.e[0].b != null) {
         var2.b.a(this.e[0].b.getName());
         var2.e = this.e[0].e;
      }

      this.e[0] = var2;
      int var6 = var4.getFirstRow();
      int var7 = var4.getFirstColumn();
      this.j = var4.getColumnCount() + var3.size();
      this.i = var4.getColumnCount();
      this.k = var4.getRowCount() - 1;
      this.q = this.p;
      this.p = new ArrayList(this.i);
      int var8 = var5.getMaxRow();
      int var9 = Math.min(var8, this.k);
      if (this.k > var9) {
         this.n = new zaun(this, var9 + 1, this.i);
      } else {
         this.n = new zaun(this, this.k, this.i);
      }

      Cell var10 = null;
      boolean var11 = true;
      Object[] var12 = new Object[2];
      HashMap var13 = new HashMap();
      int var14 = 2;

      int var15;
      zbqs var24;
      for(var15 = 0; var15 < var4.getColumnCount(); ++var15) {
         var10 = var5.a(var6, var15 + var7, false);
         if (!var13.containsKey(var10.j())) {
            var13.put(var10.j(), var15);
            com.aspose.cells.b.a.a.ze.a(this.p, (Object)(new zbqs(this, var10.j(), true)));
         } else {
            String var16 = var10.j() + var14++;
            var13.put(var16, var15);
            com.aspose.cells.b.a.a.ze.a(this.p, (Object)(new zbqs(this, var16, true)));
         }

         var24 = (zbqs)this.p.get(var15);
         int var23 = -1;
         HashMap var17 = new HashMap();
         ArrayList var18 = new ArrayList();
         int var19 = 0;
         this.n.b[var15] = true;

         for(int var20 = 1; var20 <= var9; ++var20) {
            var10 = var5.checkCell(var20 + var6, var15 + var7);
            a(var10 == null ? null : var10.l(), var24, var17, var12);
            if (var12[1] == null) {
               if (var23 == -1) {
                  zbmb var21 = new zbmb();
                  var21.a = null;
                  com.aspose.cells.b.a.a.ze.a(var18, (Object)var21);
                  var23 = var19++;
                  var24.j(true);
               }

               ((Object[])((Object[])this.n.a.get(var20 - 1)))[var15] = var23;
            } else {
               Object var30 = var17.get(var12[0]);
               if (var30 == null) {
                  ((Object[])((Object[])this.n.a.get(var20 - 1)))[var15] = var19;
                  var17.put(var12[0], var19++);
                  zbmb var22 = new zbmb();
                  var22.a = var12[1];
                  com.aspose.cells.b.a.a.ze.a(var18, (Object)var22);
               } else {
                  ((Object[])((Object[])this.n.a.get(var20 - 1)))[var15] = (Integer)var30;
               }
            }
         }

         if (this.k > var9 && !var24.u()) {
            zbmb var28 = new zbmb();
            var28.a = null;
            com.aspose.cells.b.a.a.ze.a(var18, (Object)var28);
            var24.j(true);
            ((Object[])((Object[])this.n.a.get(var9)))[var15] = var18.size() - 1;
         }

         if (this.q != null && var15 < this.q.size()) {
            com.aspose.cells.b.a.a.ze.a(var18, (Collection)this.a((zbqs)((zbqs)this.q.get(var15))));
         }

         var24.c = var18;
         if (this.q != null && var15 < this.q.size()) {
            zbqs var29 = (zbqs)((zbqs)this.q.get(var15));
            if (var24.j()) {
               var24.k = var24.x()[0];
               var24.l = var24.x()[1];
            }

            var24.j = var29.j;
            var24.q = var29.q;
         }

         if (var24.j != null) {
            var24.h(true);
         }
      }

      for(var15 = 0; var15 < var3.size(); ++var15) {
         com.aspose.cells.b.a.a.ze.a(this.p, var3.get(var15));
      }

      for(var15 = 0; var15 < this.p.size(); ++var15) {
         var24 = (zbqs)this.p.get(var15);
         if (var24 != null && this.q != null && !var24.m() && var15 < this.q.size()) {
            zbqs var26 = (zbqs)this.q.get(var15);
            if (!com.aspose.cells.b.a.zv.b(var24.a, var26.a)) {
               this.H = true;
               break;
            }
         }
      }

   }

   private void a(PivotPageFields var1) {
      if (var1 != null && var1.a() != null && var1.b() != null) {
         int var2 = this.e.length;
         this.f = new String[var1.a().size()][];

         int var3;
         int var5;
         int var6;
         for(var3 = 0; var3 < var1.a().size(); ++var3) {
            String[] var4 = (String[])((String[])var1.a().get(var3));
            var5 = var4.length;

            for(var6 = 0; var6 < var4.length; ++var6) {
               if (var4[var6] == null) {
                  --var5;
               }
            }

            this.f[var3] = new String[var5];
            var6 = 0;

            for(int var7 = 0; var7 < var4.length; ++var7) {
               if (var4[var7] != null) {
                  this.f[var3][var6++] = var4[var7];
               }
            }
         }

         if (var1.b().size() != var2) {
            throw new IllegalArgumentException("The number of pageItemIndex must equal to the number of data sources.");
         } else {
            this.g = new int[var2][];

            for(var3 = 0; var3 < var1.b().size(); ++var3) {
               int[] var8 = (int[])((int[])var1.b().get(var3));
               if (var8.length != var1.a().size()) {
                  throw new IllegalArgumentException("");
               }

               this.g[var3] = new int[var1.a().size()];
               boolean var9 = false;

               for(var6 = 0; var6 < var8.length; ++var6) {
                  var5 = var8[var6];
                  if (var5 != -1 && var5 >= this.f[var6].length) {
                     var5 = -1;
                  }

                  this.g[var3][var6] = var5;
               }
            }

         }
      }
   }

   private void a(int var1, zbqs var2) {
      boolean var3 = true;
      HashMap var4 = new HashMap();
      ArrayList var5 = new ArrayList();
      int var6 = 0;
      int[] var7 = new int[this.g.length];

      int var8;
      for(var8 = 0; var8 < this.g.length; ++var8) {
         var7[var8] = this.g[var8][var1];
      }

      boolean var14 = false;
      boolean var9 = false;

      int var10;
      int var11;
      for(var10 = 0; var10 < var7.length; ++var10) {
         var9 = false;

         for(var11 = var7.length - 2; var11 >= var10; --var11) {
            if (var7[var11 + 1] < var7[var11]) {
               var8 = var7[var11 + 1];
               var7[var11 + 1] = var7[var11];
               var7[var11] = var8;
               var9 = true;
            }
         }

         if (!var9) {
            break;
         }
      }

      for(var10 = 0; var10 < var7.length; ++var10) {
         var11 = var7[var10];
         if (var11 == -1) {
            if (var3) {
               var3 = false;
            }
         } else {
            int var12;
            for(var12 = 0; var12 < var10 && var11 != var7[var12]; ++var12) {
               ;
            }

            if (var12 == var10) {
               var4.put(this.f[var1][var11], var6++);
               zbmb var13 = new zbmb();
               var13.a = this.f[var1][var11];
               com.aspose.cells.b.a.a.ze.a(var5, (Object)var13);
            }
         }
      }

      if (!var3) {
         zbmb var15 = new zbmb();
         var15.a = null;
         com.aspose.cells.b.a.a.ze.a(var5, (Object)var15);
      }

      var2.c = var5;
      var2.e(true);
   }

   static Object a(Object var0, zbqs var1, boolean[] var2, boolean[] var3) {
      var2[0] = false;
      var3[0] = false;
      if (var0 == null) {
         return null;
      } else {
         switch(zamo.a(var0.getClass())) {
         case 3:
            if (!var1.i()) {
               var1.e(true);
            }
            break;
         case 9:
            if (!var1.f()) {
               var1.c(true);
            }
            break;
         case 14:
            if (!var1.h()) {
               var1.d(true);
            }

            double var6 = (Double)var0;
            if (Math.abs(var6) <= 2.147483647E9D && var6 == (double)((int)var6)) {
               if (!var1.f()) {
                  var1.c(true);
               }

               return (int)var6;
            }

            if (Math.abs(var6) <= 9.223372036854776E18D && var6 == (double)((long)var6)) {
               if (!var1.f()) {
                  var1.c(true);
               }

               return (long)var6;
            }

            return var6;
         case 16:
            var3[0] = true;
            DateTime var5 = (DateTime)var0;
            if (var5.getMillisecond() != 0) {
               if (var5.getMillisecond() > 500) {
                  var5 = var5.addMilliseconds((double)(1000 - var5.getMillisecond()));
               } else {
                  var5 = var5.addMilliseconds((double)(-var5.getMillisecond()));
               }
            }

            if (!var1.j()) {
               var1.f(true);
            }

            return var5;
         case 18:
            var2[0] = true;
            String var4 = (String)var0;
            if (var4.length() > 255) {
               var4 = var4.substring(0, 255);
            }

            if (!var1.i()) {
               var1.e(true);
            }

            return var4;
         }

         return var0;
      }
   }

   static void a(Object var0, zbqs var1, HashMap var2, Object[] var3) {
      var3[0] = var3[1] = var0;
      if (var0 != null) {
         switch(zamo.a(var0.getClass())) {
         case 3:
            if (!var1.i()) {
               var1.e(true);
            }
            break;
         case 9:
            if (!var1.f()) {
               var1.c(true);
            }
            break;
         case 14:
            if (var2.get(var0) != null) {
               return;
            }

            double var6 = (Double)var0;
            String var8 = zase.b(var6);
            var6 = zase.B(var8);
            if (Math.abs(var6) <= 2.147483647E9D && var6 == (double)((int)var6)) {
               if (!var1.f()) {
                  var1.c(true);
               }

               var0 = (int)var6;
            } else if (Math.abs(var6) <= 9.223372036854776E18D && var6 == (double)((long)var6)) {
               if (!var1.f()) {
                  var1.c(true);
               }

               var0 = (long)var6;
            } else {
               var0 = var6;
            }

            if (!var1.h()) {
               var1.d(true);
            }

            var3[0] = var3[1] = var0;
            break;
         case 16:
            DateTime var5 = (DateTime)var0;
            if (var5.getMillisecond() != 0) {
               if (var5.getMillisecond() > 500) {
                  var5 = var5.addMilliseconds((double)(1000 - var5.getMillisecond()));
               } else {
                  var5 = var5.addMilliseconds((double)(-var5.getMillisecond()));
               }
            }

            if (!var1.j()) {
               var1.f(true);
            }

            var3[0] = com.aspose.cells.b.a.zr.a(var5).toUpperCase();
            var3[1] = var5;
            break;
         case 18:
            String var4 = (String)var0;
            if (var4.length() > 255) {
               var4 = var4.substring(0, 255);
            }

            if (!var1.i()) {
               var1.e(true);
            }

            var3[0] = var4.toUpperCase();
            var3[1] = var4;
         }

      }
   }

   void a(String[] var1) {
      int var2;
      if (this.h) {
         var2 = var1.length;
         String[] var3 = new String[var2];
         this.g = new int[var2][];

         for(int var4 = 0; var4 < var2; ++var4) {
            var3[var4] = "item" + (var4 + 1);
            this.g[var4] = new int[]{var4};
         }

         this.f = new String[1][];
         this.f[0] = var3;
      }

      var2 = this.f == null ? 0 : this.f.length;
      this.j = this.i = 3 + var2;
      this.p = new ArrayList(this.i);
      zbqs var34 = new zbqs(this, "Row", true);
      com.aspose.cells.b.a.a.ze.a(this.p, (Object)var34);
      zbqs var35 = new zbqs(this, "Column", true);
      com.aspose.cells.b.a.a.ze.a(this.p, (Object)var35);
      zbqs var5 = new zbqs(this, "Value", false);
      com.aspose.cells.b.a.a.ze.a(this.p, (Object)var5);
      int var6;
      if (this.f != null) {
         for(var6 = 0; var6 < this.f.length; ++var6) {
            com.aspose.cells.b.a.a.ze.a(this.p, (Object)(new zbqs(this, "Page" + (var6 + 1), true)));
            this.a(var6, (zbqs)this.p.get(3 + var6));
         }
      }

      for(var6 = 0; var6 < var1.length; ++var6) {
         this.e[var6] = this.b(var1[var6]);
         Range var7 = this.e[var6].b;
         this.k += (var7.getRowCount() - 1) * (var7.getColumnCount() - 1);
      }

      this.n = new zaun(this, this.k, this.i);
      HashMap var36 = new HashMap();
      ArrayList var37 = new ArrayList();
      var34.c = var37;
      int var8 = 0;
      HashMap var9 = new HashMap();
      ArrayList var10 = new ArrayList();
      var35.c = var10;
      int var11 = 0;
      int var12 = 0;
      Cell var13 = null;
      boolean var14 = false;
      int var15 = -1;
      int var16 = -1;
      boolean var17 = false;
      boolean var18 = false;

      for(int var19 = 0; var19 < this.e.length; ++var19) {
         Cells var20 = this.e[var19].a.getCells();
         Range var21 = this.e[var19].b;
         int var22 = var21.getFirstRow();
         int var23 = var21.getRowCount() - 1;
         int var24 = var21.getFirstColumn();
         int var25 = var21.getColumnCount() - 1;
         int[] var26 = null;
         if (this.g != null) {
            var26 = new int[this.g[var19].length];

            for(int var27 = 0; var27 < var26.length; ++var27) {
               if (this.g[var19][var27] == -1) {
                  var26[var27] = ((zbqs)this.p.get(3 + var19)).c.size() - 1;
               } else {
                  var26[var27] = this.g[var19][var27];
               }
            }
         }

         int[] var39 = new int[var25];

         int var28;
         zbmb var29;
         boolean[] var30;
         Object var31;
         zbmb var32;
         zbmb var33;
         int var38;
         boolean[] var40;
         Object var44;
         for(var28 = 1; var28 <= var25; ++var28) {
            var13 = var20.a(var22, var24 + var28, false);
            if (var13.getType() == 3) {
               if (var15 == -1) {
                  var29 = new zbmb();
                  var29.a = null;
                  com.aspose.cells.b.a.a.ze.a(var10, (Object)var29);
                  var15 = var11++;
               }

               var39[var28 - 1] = var15;
            } else {
               var40 = new boolean[]{var17};
               var30 = new boolean[]{var18};
               var31 = a(var13.getValue(), var35, var40, var30);
               var17 = var40[0];
               var18 = var30[0];
               if (var31 == null) {
                  if (var15 == -1) {
                     var32 = new zbmb();
                     var32.a = null;
                     com.aspose.cells.b.a.a.ze.a(var10, (Object)var32);
                     var15 = var11++;
                  }

                  var39[var28 - 1] = var15;
               } else {
                  var32 = null;
                  if (var17) {
                     var44 = var9.get(((String)var31).toUpperCase());
                  } else if (var18) {
                     var44 = var9.get(com.aspose.cells.b.a.zr.a(var31).toUpperCase());
                  } else {
                     var44 = var9.get(var31);
                  }

                  if (var44 == null) {
                     var38 = var11;
                     if (var17) {
                        var9.put(((String)var31).toUpperCase(), var11++);
                     } else if (var18) {
                        var9.put(com.aspose.cells.b.a.zr.a(var31).toUpperCase(), var11++);
                     } else {
                        var9.put(var31, var11++);
                     }

                     var33 = new zbmb();
                     var33.a = var31;
                     com.aspose.cells.b.a.a.ze.a(var10, (Object)var33);
                  } else {
                     var38 = (Integer)var44;
                  }

                  var39[var28 - 1] = var38;
               }
            }
         }

         for(var28 = 1; var28 <= var23; ++var28) {
            var13 = var20.a(var28 + var22, var24, false);
            if (var13.getType() == 3) {
               if (var16 == -1) {
                  var29 = new zbmb();
                  var29.a = null;
                  com.aspose.cells.b.a.a.ze.a(var37, (Object)var29);
                  var16 = var8++;
               }

               var38 = var16;
            } else {
               var40 = new boolean[]{var17};
               var30 = new boolean[]{var18};
               var31 = a(var13.getValue(), var34, var40, var30);
               var17 = var40[0];
               var18 = var30[0];
               if (var31 == null) {
                  if (var16 == -1) {
                     var16 = var8++;
                     var32 = new zbmb();
                     var32.a = null;
                     com.aspose.cells.b.a.a.ze.a(var37, (Object)var32);
                  }

                  var38 = var16;
               } else {
                  var32 = null;
                  if (var17) {
                     var44 = var36.get(((String)var31).toUpperCase());
                  } else if (var18) {
                     var44 = var36.get(com.aspose.cells.b.a.zr.a(var31).toUpperCase());
                  } else {
                     var44 = var36.get(var31);
                  }

                  if (var44 == null) {
                     var38 = var8;
                     if (var17) {
                        var36.put(((String)var31).toUpperCase(), var8++);
                     } else if (var18) {
                        var36.put(com.aspose.cells.b.a.zr.a(var31).toUpperCase(), var8++);
                     } else {
                        var36.put(var31, var8++);
                     }

                     var33 = new zbmb();
                     var33.a = var31;
                     com.aspose.cells.b.a.a.ze.a(var37, (Object)var33);
                  } else {
                     var38 = (Integer)var44;
                  }
               }
            }

            for(int var41 = 0; var41 < var25; ++var41) {
               Object[] var42 = (Object[])((Object[])this.n.a.get(var12));
               var42[0] = var38;
               var42[1] = var39[var41];
               var13 = var20.checkCell(var28 + var22, var24 + var41 + 1);
               if (var13 == null) {
                  var42[2] = null;
               } else {
                  var42[2] = var13.getValue();
               }

               for(int var43 = 0; var43 < var26.length; ++var43) {
                  var42[3 + var43] = var26[var43] & '\uffff';
               }

               ++var12;
            }
         }
      }

   }

   boolean b() {
      return this.d(4);
   }

   void a(boolean var1) {
      this.a(var1, 4);
   }

   void a(boolean var1, int var2) {
      this.l &= ~var2;
      this.l |= var1 ? var2 & '\uffff' : 0;
   }

   boolean d(int var1) {
      return (this.l & '\uffff' & var1) != 0;
   }

   int c() {
      byte var1 = 12;
      int var2;
      switch(this.d) {
      case 1:
         if (this.e == null) {
            return -1;
         }

         var2 = var1 + this.e[0].b();
         break;
      case 4:
         var2 = var1 + this.e();
         break;
      default:
         throw new IllegalArgumentException("Unsupported PivotTable source type.");
      }

      return var2;
   }

   void a(zqa var1) throws Exception {
      if (this.z != null) {
         for(int var4 = 0; var4 < this.z.size(); ++var4) {
            var1.a((byte[])((byte[])this.z.get(var4)));
         }

      } else {
         byte[] var2 = this.d();
         if (var2 != null) {
            var1.a(var2);
         }

         if (this.A.getCount() > 0) {
            for(int var3 = 0; var3 < this.A.getCount(); ++var3) {
               zays.a(var1, (byte[])this.A.a(var3));
            }
         } else {
            zays.a(var1, this);
         }

      }
   }

   byte[] d() {
      if (this.c() < 0) {
         return null;
      } else {
         byte[] var1 = new byte[this.c()];
         byte var2 = 0;
         int var4 = var2 + b(var1, var2, this.r);
         var4 += a(var1, var4, this.d);
         switch(this.d) {
         case 1:
            var4 += this.e[0].a(var1, var4);
            break;
         case 4:
            var4 += this.a(var1, var4);
            break;
         default:
            throw new IllegalArgumentException("Unsupported PivotTable source type.");
         }

         return var1;
      }
   }

   void a(com.aspose.cells.b.a.d.zh var1) throws Exception {
      zqa var2 = new zqa(var1);
      if (this.G != null) {
         Iterator var14 = this.G.iterator();

         while(var14.hasNext()) {
            byte[] var15 = (byte[])var14.next();
            var2.a(var15);
         }

         var2.a((int)10);
      } else {
         zbqm var3 = new zbqm(this);
         var3.a(var2);
         zbql var4 = new zbql(this);
         var4.a(var2);
         if (this.v != null) {
            Iterator var5 = this.v.iterator();

            while(var5.hasNext()) {
               zaus var6 = (zaus)var5.next();
               zbqv var7 = new zbqv(var6);
               var7.a(var2);
               if (var6.d != null) {
                  for(int var8 = 0; var8 < var6.d.getCount(); ++var8) {
                     zbrf var9 = var6.d.a(var8);
                     zbrj var10 = new zbrj(var9);
                     var10.a(var2);

                     for(int var11 = 0; var11 < var9.b().getCount(); ++var11) {
                        zbrg var12 = var9.b().a(var11);
                        zbrh var13 = new zbrh(var12);
                        var13.a(var2);
                     }
                  }
               }

               zbrp var18 = new zbrp(var6.f);
               var18.a(var2);
               if (var6.f.e != null) {
                  for(int var19 = 0; var19 < var6.f.e.size(); ++var19) {
                     zbqw var21 = (zbqw)var6.f.e.get(var19);
                     zbqx var22 = new zbqx(var21);
                     var22.a(var2);
                     byte[] var23 = new byte[]{-11, 0, 2, 0, 0, 0};

                     for(int var24 = 0; var24 < var21.c.size(); ++var24) {
                        System.arraycopy(com.aspose.cells.b.a.zc.a((Integer)((Integer)var21.c.get(var24))), 0, var23, 4, 2);
                        var2.a(var23);
                     }
                  }
               }

               zbrb var20 = new zbrb(var6);
               var20.a(var2);
            }
         }

         if (this.p != null) {
            for(int var16 = 0; var16 < this.p.size(); ++var16) {
               zbqs var17 = (zbqs)this.p.get(var16);
               var17.a(var2);
            }
         }

         if (this.n != null) {
            this.n.a(var2);
         }

         var2.a((int)10);
      }
   }

   int e() {
      int var1 = 10;

      int var2;
      for(var2 = 0; var2 < this.e.length; ++var2) {
         var1 += this.e[var2].b();
      }

      if (this.g == null) {
         var1 += 4 * this.e.length;
      } else {
         for(var2 = 0; var2 < this.g.length; ++var2) {
            var1 += 4 + 2 * this.g[var2].length;
         }
      }

      if (this.f != null) {
         for(var2 = 0; var2 < this.f.length; ++var2) {
            int var3 = this.f[var2].length;
            var1 += 6;

            for(int var4 = 0; var4 < var3; ++var4) {
               var1 += 6 + zakq.e(this.f[var2][var4]);
            }
         }
      }

      return var1;
   }

   int f() {
      int var1 = 0;
      if (this.e == null) {
         return 0;
      } else {
         zqr[] var2 = this.e;
         int var3 = var2.length;

         for(int var4 = 0; var4 < var3; ++var4) {
            zqr var5 = var2[var4];
            if (var5.b != null) {
               var1 += var5.b.getRowCount() - 1;
            }
         }

         return var1;
      }
   }

   String[] g() {
      if (this.e == null) {
         return null;
      } else {
         String[] var1 = new String[this.e.length];

         for(int var2 = 0; var2 < this.e.length; ++var2) {
            var1[var2] = this.e[var2].a();
         }

         return var1;
      }
   }

   int a(byte[] var1, int var2) {
      int var3 = var2;
      var2 += this.b(var1, var2);

      for(int var4 = 0; var4 < this.e.length; ++var4) {
         var2 += this.e[var4].a(var1, var2);
      }

      var2 += this.c(var1, var2);
      if (this.f != null) {
         var2 += this.d(var1, var2);
      }

      return var2 - var3;
   }

   int b(byte[] var1, int var2) {
      short var3 = (short)(this.f.length | (this.h ? '耀' : 0));
      var1[var2++] = -48;
      var1[var2++] = 0;
      var1[var2++] = 6;
      var1[var2++] = 0;
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)this.e.length), 0, var1, var2, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)this.g.length), 0, var1, var2 + 2, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3), 0, var1, var2 + 4, 2);
      return 10;
   }

   int c(byte[] var1, int var2) {
      int var3 = var2;
      int var4;
      if (this.g == null) {
         for(var4 = 0; var4 < this.e.length; ++var4) {
            var1[var2++] = -46;
            var1[var2++] = 0;
            var1[var2++] = 0;
            var1[var2++] = 0;
         }

         return var2 - var3;
      } else {
         for(var4 = 0; var4 < this.g.length; ++var4) {
            var1[var2++] = -46;
            var1[var2++] = 0;
            int var5 = this.g[var4].length;
            System.arraycopy(com.aspose.cells.b.a.zc.a((short)(var5 * 2)), 0, var1, var2, 2);
            var2 += 2;

            for(int var6 = 0; var6 < var5; ++var6) {
               System.arraycopy(com.aspose.cells.b.a.zc.a((short)this.g[var4][var6]), 0, var1, var2, 2);
               var2 += 2;
            }
         }

         return var2 - var3;
      }
   }

   int d(byte[] var1, int var2) {
      int var3 = var2;

      for(int var4 = 0; var4 < this.f.length; ++var4) {
         int var5 = this.f[var4].length;
         var2 += a(var1, var2, var5);

         for(int var6 = 0; var6 < var5; ++var6) {
            var2 += zbqs.a(var1, var2, this.f[var4][var6]);
         }
      }

      return var2 - var3;
   }

   static int a(byte[] var0, int var1, int var2) {
      var0[var1++] = -47;
      var0[var1++] = 0;
      var0[var1++] = 2;
      var0[var1++] = 0;
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var2), 0, var0, var1, 2);
      return 6;
   }

   static int b(byte[] var0, int var1, int var2) {
      var0[var1++] = -43;
      var0[var1++] = 0;
      var0[var1++] = 2;
      var0[var1++] = 0;
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var2), 0, var0, var1, 2);
      return 6;
   }

   static int a(byte[] var0, int var1, byte var2) {
      var0[var1++] = -29;
      var0[var1++] = 0;
      var0[var1++] = 2;
      var0[var1++] = 0;
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var2), 0, var0, var1, 2);
      return 6;
   }

   static Object[] a(WorksheetCollection var0, String var1, Worksheet var2) {
      String[] var3 = zakq.g(var1);
      String var4 = var3[0];
      String var5 = var3[1];
      Worksheet var6 = null;
      if (var4 != null) {
         var6 = var0.get(var4);
      }

      boolean var7 = true;
      int var11;
      if (var6 == null && var2 != null) {
         var11 = var2.getIndex();
      } else if (var6 == null && var2 == null) {
         var11 = -1;
      } else {
         var11 = var6.getIndex();
      }

      Object var8 = null;
      Object[] var9 = new Object[2];
      Range var10 = null;
      var10 = zbsg.a(var0, var11, 0, 0, var5, true);
      if (var10 != null) {
         var9[0] = var10.a();
         var9[1] = var10.getWorksheet();
         return var9;
      } else {
         var8 = zakq.a(var0, var11, var5.toCharArray());
         if (var8 == null) {
            var8 = zakq.a(var0, -1, var5.toCharArray());
            if (var8 == null) {
               throw new IllegalArgumentException("Unkown Area");
            }
         }

         var9[0] = var8;
         var9[1] = var6;
         return var9;
      }
   }
}
